/*
 * @Description: 租户管理api接口集合
 * @FilePath: \hk-computerRoom-Security\src\api\system\tenant\index.ts
 * @Date: 2024-01-03 16:05:06
 * @LastEditTime: 2024-01-03 16:11:14
 */

import axiosRequest from '/@/utils/request';
/**
 * （不建议写成 request.post(xxx)，因为这样 post 时，无法 params 与 data 同时传参）
 *
 * 岗位管理api接口集合
 * @method addTenant 开户
 * @method updateTenant 修改租户
 * @method pageTenant 分页查询
 * @method getTenantById 获取租户信息
 * @method getTenantMenuTree 获取租户的所有菜单权限
 * @method enableTenant 启用/禁用租户
 */
export function useTenantApi() {
  return {
    addTenant: async (params: object) => {
      return await axiosRequest({
        url: '/api/tenant/addTenant',
        method: 'POST',
        data: params,
      });
    },
    updateTenant: async (params: object) => {
      return await axiosRequest({
        url: '/api/tenant/updateTenant',
        method: 'POST',
        data: params,
      });
    },
    pageTenant: async (params: object) => {
      return await axiosRequest({
        url: '/api/tenant/pageTenant',
        method: 'post',
        data: params,
      });
    },
    getTenantById: async (id: string) => {
      return await axiosRequest({
        url: `/api/tenant/getTenant/${id}`,
        method: 'POST',
      });
    },
    getTenantMenuTree: async (params: object) => {
      return await axiosRequest({
        url: '/api/tenant/getTenantMenuTree',
        method: 'POST',
        params,
      });
    },
    enableTenant: async (params: object) => {
      return await axiosRequest({
        url: '/api/tenant/enableTenant',
        method: 'POST',
        data: params,
      });
    },
  }
}
